package com.acknight.controller;


import com.acknight.dto.Result;
import com.acknight.entity.BlogComments;
import com.acknight.entity.DetailBlogComment;
import com.acknight.service.DetailBlogCommentService;
import com.acknight.service.IBlogCommentsService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/blog-comments")
@CrossOrigin
public class BlogCommentsController {

    @Resource
    private DetailBlogCommentService detailBlogCommentService;

    @GetMapping("/commentList")
    public Result commentList(@RequestParam("articleId") Long articleId,
                              @RequestParam("pageNum") Integer pageNum,
                              @RequestParam("pageSize") Integer pageSize) {
        return detailBlogCommentService.commentList(articleId, pageNum, pageSize);
    }

    @PostMapping("/addCommit")
    public Result addCommit(@RequestBody DetailBlogComment detailBlogComment) {
        return detailBlogCommentService.addCommit(detailBlogComment);
    }
}
